import { ref } from 'vue'
import { random } from 'lodash'
import { useIntervalFn } from '@vueuse/core'

export const useRandom = (start: number, end: number, delay = 1000) => {
  const _ref = ref(0)
  const timer = useIntervalFn(() => {
    _ref.value = random(start, end)
  }, delay)
  return { ref: _ref, timer }
}
